//
//  Bottle_Des.m
//  PartyGame
//
//  Created by Peteo on 11-8-20.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Bottle_Des.h"
#import "GameConfig.h"

@implementation Bottle_Des

@synthesize m_nReturn;

+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	Bottle_Des *layer = [Bottle_Des node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}

-(void)Bottle_Des_Return:(id)sender
{
	if(delegate)
	{
		[delegate Bottle_DesSelect:0];
	}
}

-(id)init:(id<Bottle_DesDelegate>) _delegate
{
	self = [super init];
	if (self)
	{
		delegate = _delegate;
		
		CGSize size = [[CCDirector sharedDirector] winSize];
		
		//背景
		CCSprite *sp = [CCSprite spriteWithFile:@"bg_bottle.png"];
		sp.position = ccp(size.width/2, size.height/2);
		[self addChild:sp z:0 tag:1];
		
		//底部背景
		CCSprite *bottomBg=[CCSprite spriteWithFile:@"bottom_bg.png"];
		bottomBg.position = ccp(SCREEN_WIDTH/2,BOTTOM_HEIGHT);
		[self addChild:bottomBg];
		
		
		//提示框
		CCSprite *tipBg=[CCSprite spriteWithFile:@"tipFrame.png"];
		tipBg.position = ccp(SCREEN_WIDTH/2,SCREEN_HEIGHT/2);
		[self addChild:tipBg];
		
		//游戏说明
		CCSprite *gamedes=[CCSprite spriteWithFile:@"game_des.png"];
		gamedes.position = ccp(SCREEN_WIDTH/2,SCREEN_HEIGHT - 40);
		[self addChild:gamedes];
		
		/*
		CCLabelTTF* label = [CCLabelTTF labelWithString:@"游戏开始前，所有玩家围绕手机坐成一圈\r\n• 预先输入惩罚方法。\r\n• 手指触摸瓶身转动酒瓶。\r\n• 酒瓶停止转动时，系统随机或者（指定）弹出预先输入惩罚方法，瓶口指向玩家接受大家的惩罚。" 
											 dimensions:CGSizeMake(320,400) alignment:CCTextAlignmentLeft 
											   fontName:@"Arial" fontSize:20];
		
		[self addChild: label z:1];
		[label setPosition: ccp(160,200)];
		*/
		
		CCLabelTTF* label = [CCLabelTTF labelWithString:@"  1. 玩家依次输入姓名，输入\r\n      完成开始游戏。\r\n  2. 转盘上的数字编号代表不\r\n      同玩家。\r\n  3. 任意一名玩家用手指划过\r\n      界面使酒瓶转动。\r\n  4. 酒瓶停止转动后指向最接\r\n      近的数字所代表的玩家接\r\n      受惩罚。" 
											 dimensions:CGSizeMake(226,300) alignment:CCTextAlignmentLeft 
											   fontName:@"Arial" fontSize:17];
		[label setPosition: ccp(SCREEN_WIDTH/2,228)];
		[self addChild: label z:1];
		
		//返回
		CCMenuItemImage *vm = [CCMenuItemImage itemFromNormalImage:@"back_icon.png" selectedImage:nil target:self selector:@selector(Bottle_Des_Return:)];	
		CCMenu *vmm = [CCMenu menuWithItems: vm, nil];
		vmm.position = ccp(BOTTOM_X, BOTTOM_HEIGHT);
		[self addChild:vmm z:2];
	}
	return self;
}

- (void)layerReplaced
{
	
}

@end
